<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>文档列表 - CoCo后台管理系统</title>
<link rel="icon" href="favicon.ico" type="image/ico">
<meta name="author" content="yinqi">
<link href="__STATIC__/admin/css/bootstrap.min.css" rel="stylesheet">
<link href="__STATIC__/admin/css/materialdesignicons.min.css" rel="stylesheet">
<link href="__STATIC__/admin/css/style.min.css" rel="stylesheet">
</head>
  
<body>
<div class="lyear-layout-web">
  <div class="lyear-layout-container">
    
    <!--左侧导航-->
    {include file="../application/admin/view/common/left.html"}
    <!--End 左侧导航-->
    
    <!--头部信息-->
    {include file="../application/admin/view/common/header.html"}
    <!--End 头部信息-->
    
    <!--页面主要内容-->
    <main class="lyear-layout-content">
      
      <div class="container-fluid">
        
        <div class="row">
          <div class="col-lg-12">
            <div class="card">
              <div class="card-toolbar clearfix">
                <div class="toolbar-btn-action">
                  <a class="btn btn-primary m-r-5" href="/admin/food/add_type"><i class="mdi mdi-plus"></i>类型新增</a>
                </div>
              </div>
              <div class="card-body">
                
                <div class="table-responsive">
                  <table class="table table-bordered">
                    <thead>
                      <tr>
                        <th>ID</th>
                        <th>餐品类型名称</th>
                        <th>添加时间</th>
                        <th>操作</th>
                      </tr>
                    </thead>
                    <tbody>
                      {volist name="ret" id="r1"}
                      <tr>
                        <td>{$r1.type_id}</td>
                        <td>{$r1.type_name}</td>
                        <td>{$r1.addtime|date="Y-m-d H:i:s",###}</td>
                        <td>
                          <div class="btn-group">
                            <a class="btn btn-xs btn-default" onclick="type_del('{$r1.type_id}');" title="删除" data-toggle="tooltip"><i class="mdi mdi-window-close"></i></a>
                          </div>
                        </td>
                      </tr>
                      {/volist}
                    </tbody>
                  </table>
                </div>
                {$pageHtml}
              </div>
            </div>
          </div>
        </div>
      </div>
    </main>
    <!--End 页面主要内容-->
  </div>
</div>

<script type="text/javascript" src="__STATIC__/admin/js/jquery.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin/js/bootstrap.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin/js/perfect-scrollbar.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin/js/main.min.js"></script>
<script type="text/javascript">
  layui.use('layer', function(){
    var layer = layui.layer;
  });
function type_del(type_id){
    layer.confirm('确定删除该类型吗?', {icon: 3}, function(index){
        $.ajax({
            url:'/admin/food/type_del',
            type:'get',
            dataType:'json',
            data:{type_id:type_id},
            success:function(data){
              if(data.status==0){
                layer.msg(data.msg,{icon: 5,time:2000,success:function(){
              setTimeout(function(){window.location.reload();},1000);
            }});
              }else{
                layer.msg(data.msg,{icon: 6,time:2000,success:function(){
              setTimeout(function(){window.location.reload();},1000);
            }});
              }
            }
          });
        layer.close(index);
      });
  }

$(function(){
    $('.search-bar .dropdown-menu a').click(function() {
        var field = $(this).data('field') || '';
        $('#search-field').val(field);
        $('#search-btn').html($(this).text() + ' <span class="caret"></span>');
    });
});
</script>
</body>
</html>